#ifndef TEXMODULEREGISTEREDITOR_H
#define TEXMODULEREGISTEREDITOR_H

#include <QWidget>
#include <QLabel>
#include <QLineEdit>
#include <QGroupBox>
#include <QCheckBox>
#include <QTabWidget>
#include <QPushButton>
#include <QGridLayout>
#include <QTableWidget>
#include <QProgressBar>

class texModuleRegisterEditor : public QWidget
{
    Q_OBJECT

public:
    texModuleRegisterEditor();
    bool contentsChanged() const;

signals:
    void modified(bool);

private:
    /* global */
    QGridLayout *layout;
    QPushButton *read, *program;
    QProgressBar *progress;

    /* general module information */
    QGroupBox *grpModuleInformation;
    QLabel *lblBoardNumber;
    QLineEdit *boardNumber;
    QLabel *lblBoardRevision;
    QLineEdit *boardRevision;
    QLabel *lblBoardConfiguration;
    QLineEdit *boardConfiguration;

    /* codes */
    QGroupBox *grpCodes;
    QLabel *lblCodes[6];
    QLineEdit *codes[6];

    /* scale & offset */
    QGroupBox *grpScale, *grpOffset;
    QGridLayout *layoutScale, *layoutOffset;
    QLabel *lblScale[8], *lblOffset[8];
    QLineEdit *scale[8], *offset[8];
    QCheckBox *checkScale[8], *checkOffset[8];

    /* lin tables */
    QTabWidget *tabWidgetLinTables; // tabWidget to hold the tabs
    QWidget *tabLinTable[4];        // the actual tab, holding:
    QGridLayout *layoutLinTable[4]; // the grid layout, holding:
    QTableWidget *linTable[4];      // the lin table
    QCheckBox *checkLinTable[4];    // the enable/disable checkbox
    QPushButton *loadLinTable[4];   // load button
    QPushButton *saveLinTable[4];   // save button

    bool changed;

    void createRegisterBoxen();

private slots:
    void dataChanged();
};

#endif // TEXMODULEREGISTEREDITOR_H
